//! By convention, root.zig is the root source file when making a library. If
//! you are making an executable, the convention is to delete this file and
//! start with main.zig instead.
const std = @import("std");
const rl = @import("raylib");
const zlua = @import("zlua");
const ecs = @import("ecs");
// const flecs = @import("zflecs");
const Game = @import("./game/game.zig").Game;
// pub const EntityTraits = ecs.EntityTraitsType(.small);
const Lua = zlua.Lua;
const print = std.debug.print;

pub fn game_start() !void {
    var allocator = std.heap.ArenaAllocator.init(std.heap.smp_allocator);
    defer allocator.deinit();
    var reg = ecs.Registry.init(std.heap.smp_allocator);
    defer reg.deinit();
    var game = Game.init(.{
        .allocator = allocator.allocator(),
        .reg = &reg,
    });
    defer game.deinit();
    // print("game type: {}\n", .{game});
    game.init_window();
    defer game.close_window();

    // const ecs = flecs.init();
    // _ = flecs.progress(ecs, 0);
    while (!game.should_close_window()) {
        game.update();
    }
}
